// JavaScript Document
//支持Enter键登录
document.onkeydown = function(e) {
	if ($(".bac").length == 0) {
		if (!e)
			e = window.event;
		if ((e.keyCode || e.which) == 13) {
			var obtnLogin = document.getElementById("submit_btn_register")
			obtnLogin.focus();
		}
	}
}

$(function() {
	
	$("#email").blur(function(){
		var email = $("#email").val();
			  
		$.ajax({
	        url : Utils.basePath +'userInfo/exits',
	        data : {"email":email},
	        success  : function(data) {
	        	layer.alert(data.message);
			},
			error : function(data){
				console.info(data);
			}
	    });
		
	})
	
	$(".am-btn-primary").click(function(){
		var email = $("#email").val();
		var passWord = $("#passWord").val();
		
		if(!Utils.emailReg.test(email)){
    		layer.msg("请输入正确的电子邮箱！");
    		return;
		}
			  
		$.ajax({
	        url : Utils.basePath +'userInfo/add',
	        data : {"email":email,"passWord":passWord},
	        success  : function(data) {
	        	layer.alert(data.message);
			},
			error : function(data){
				console.info(data);
			}
	    });
		
	})
});